///////////////////////////////////////////////////////////////////////////////
//
//  Copyright 
//
///////////////////////////////////////////////////////////////////////////////

package goodcoregame.database.character
{

import goodcoregame.events.database.character.CharacterDataEvent;

import ru.goodcore.database.Data;
import ru.goodcore.database.DataContainer;
import ru.goodcore.database.IData;

//-------------------------------------
//  Events
//-------------------------------------

[Event(name="characterChange", type="goodcoregame.events.database.character.CharacterDataEvent")]

[Event(name="characterLevelChange", type="goodcoregame.events.database.character.CharacterDataEvent")]

[Event(name="characterActionChange", type="goodcoregame.events.database.character.CharacterDataEvent")]

[Event(name="characterRotationChange", type="goodcoregame.events.database.character.CharacterDataEvent")]

/**
 * @author					Dimarik
 * @version					1.0
 * @playerversion			Flash 9
 * @langversion				3.0
 */
public class CharacterData extends DataContainer {

	//-------------------------------------------------------------------------
	//
	//  Constructor
	//
	//-------------------------------------------------------------------------

	/**
	 * Constructor 
	 */
	public function CharacterData() {
		super();
		//super.addChild( this.experience );
		//super.addChild( this.health );
	}

	//-------------------------------------------------------------------------
	//
	//  Properties
	//
	//-------------------------------------------------------------------------

	//---------------------------------
	//  race
	//---------------------------------
	/**
	 * @private
	 */
	private var _race:	String = '';

	public function get race():String {
		return this._race;
	}

	public function set race(value:String):void {
		if ( this._race == value ) return;
		this._race = value;
		super.dispatchEvent( new CharacterDataEvent(CharacterDataEvent.CHARACTER_CHANGE, true) );
	}


	//---------------------------------
	//  sex
	//---------------------------------
	/**
	 * @private
	 */
	private var _sex:	Boolean = true;

	public function get sex():Boolean {
		return this._sex;
	}

	public function set sex(value:Boolean):void {
		if ( this._sex == value ) return;
		this._sex = value;
		super.dispatchEvent( new CharacterDataEvent(CharacterDataEvent.CHARACTER_CHANGE, true) );
	}

	//---------------------------------
	//  level
	//---------------------------------
	/**
	 * @private
	 */
	private var _level:	uint = 0;

	public function get level():uint {
		return this._level;
	}

	public function set level(value:uint):void {
		if ( this._level == value ) return;
		this._level = value;
		super.dispatchEvent( new CharacterDataEvent( CharacterDataEvent.CHARACTER_CHANGE, true ) );
		super.dispatchEvent( new CharacterDataEvent( CharacterDataEvent.CHARACTER_LEVEL_CHANGE, true ) );
	}

	//---------------------------------
	//  action
	//---------------------------------
	/**
	 * @private
	 */
	private var _action:	uint = 0;

	public function get action():uint {
		return this._action;
	}

	public function set action(value:uint):void {
		if ( this._action == value ) return;
		this._action = value;
		super.dispatchEvent( new CharacterDataEvent( CharacterDataEvent.CHARACTER_ACTION_CHANGE, true ) );
	}

	//---------------------------------
	//  rotaton
	//---------------------------------
	/**
	 * @private
	 */
	private var _rotation:	Number = 0;

	public override function get rotation():Number {
		return this._rotation;
	}

	public override function set rotation(value:Number):void {
		if ( this._rotation == value ) return;
		this._rotation = value;
		super.dispatchEvent( new CharacterDataEvent( CharacterDataEvent.CHARACTER_ROTATION_CHANGE, true ) );
	}

	//---------------------------------
	//  experience
	//---------------------------------

	//public const experience:	Points32Data = new Points32Data();


	//---------------------------------
	//  health
	//---------------------------------

	//public const health:		Points16Data = new Points16Data();


	//--------------------------------------------------------------------------
	//
	//  Protected overriden methods
	//
	//--------------------------------------------------------------------------

	protected override function addChildBefore(child:IData):void {
		super.addChildBefore( child );
	}

	protected override function removeChildBefore(child:IData):void {
		super.removeChildBefore( child );
	}

	//--------------------------------------------------------------------------
	//
	//  Private methods
	//
	//--------------------------------------------------------------------------

	//--------------------------------------------------------------------------
	//
	//  Event handlers
	//
	//--------------------------------------------------------------------------


}
}